Skip to content

fix(build): report declaration-build failures as AB4716 with the underlying TypeScript diagnostics - #265

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
fix/176-declaration-diagnostics
Sep 2, 2026
Merged

fix(build): report declaration-build failures as AB4716 with the underlying TypeScript diagnostics#265
ScriptedAlchemy merged 1 commit into
mainfrom
fix/176-declaration-diagnostics

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Closes #176.

  • Declaration-build failures get their own AB4716 code (in the AB471x package-build lib family) instead of the AB5000 catch-all whose dev-lock meaning misdirected triage of feat(routes): migrate audiobook curator to public authoring #150/fix(examples): export CliCommandDefinition so declaration emit can name it #174.
  • When the rslib dts pass aborts, the package build replays declaration emit over the same synthesized dts tsconfig using the consumer project's own typescript (--declaration --emitDeclarationOnly --pretty false), and reports one AB4716 error per recovered TypeScript diagnostic — file, (line,column), TS code, and compiler message, with sourcePath set — in both human and --json CLI output.
  • Every entry carries a recovery hint naming the trap: emit-only errors such as TS4023 are invisible to tsc --noEmit; replay with tsc --declaration --emitDeclarationOnly.
  • Degraded path: if no diagnostic can be recovered (no resolvable typescript, or the replay passes), the failure still reports as a single AB4716 carrying the bundler's message — never AB5000.
  • docs/diagnostics.md documents the new code; changeset: agent-bundle minor (additive diagnostic contract surface, per repo precedent).

Detection keys on rsbuild-plugin-dts's prose failure line (no structured signal exists); if upstream rewords it, declaration failures degrade back to today's behavior rather than breaking.

Test plan

  • New integration test: fixture with an exported factory naming an unexported type (emit-only TS4023) asserts exit 1, only AB4716 codes, src/index.ts(3,14) + message + sourcePath + --noEmit recovery hint (package-build.test.ts, 14/14 pass)
  • pnpm build, pnpm typecheck, pnpm lint green on HEAD rebased over origin/main
  • Neighbouring suites: build.test.ts, dev-package-build.test.ts, dev-package-build-service.test.ts pass

…pt diagnostics (#176)

Declaration generation rides rsbuild-plugin-dts, which aborts with one prose
line naming only its Rslib environment. The CLI wrapped that in the AB5000
catch-all, whose dev-lock meaning misdirected triage of #174's emit-only
TS4023 regression, and the five underlying diagnostics were lost — recovering
them needed a manual `tsc --declaration --emitDeclarationOnly` replay.

The package build now performs that replay itself: on a declaration abort it
re-runs declaration emit over the same synthesized dts tsconfig, through the
`typescript` resolved from the consumer project, into a throwaway directory,
and reports one AB4716 error per recovered diagnostic with the file,
(line,column), TS code, message, and sourcePath. AB4716 joins the AB471x
package-build `lib` family. Every diagnostic carries a recovery hint naming
the trap: emit-only errors such as TS4023 are invisible to `tsc --noEmit`.
@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ef5e125

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-bundle Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ScriptedAlchemy
ScriptedAlchemy merged commit cee25b8 into main Sep 2, 2026
4 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T02:58:33.434606Z ef5e125 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Declaration-build failures surface as catch-all AB5000 with the TypeScript diagnostics swallowed

1 participant